-- 自定义code actions
local null_ls = require("null-ls")

local my_actions = {
  method = null_ls.methods.CODE_ACTION,
  filetypes = { "markdown" },
  generator = {
    fn = function(context)
      -- local first_line = context.context[1]
      return {
        {
          title = 'add "hi mom"',
          action = function()
            local current_row = vim.api.nvim_win_get_cursor(0)[1]
            vim.api.nvim_buf_set_lines(0, current_row, current_row, true, { "hi mom" })
          end,
        },
      }
    end,
  },
}
null_ls.register(my_actions)
